Method and apparatus for encoding and decoding motion vectors

ABSTRACT

There is provided a method and apparatus for encoding and decoding motion vectors. Motion vectors are encoded through the steps of: (a) predicting motion vectors of a type identical to that of a present block and obtaining predictive motion vectors with respect to neighbor blocks having motion vectors of a type different from that of the present block among a plurality of neighbor blocks adjacent to the present block; (b) calculating a representative value of the motion vectors of the type identical to that of the present block from the motion vectors of the neighbor blocks and the predictive motion vectors; (c) calculating a difference value between the calculated representative value and the motion vector of the present block; and (d) encoding the calculated difference value. The motion vectors can be more efficiently encoded even when they refer to different reference pictures.

BACKGROUND OF THE INVENTION

This application claims the priority of Korean Patent Application No.2002-41798, filed Jul. 16, 2002 in the Korean Intellectual PropertyOffice, the disclosure of which is incorporated herein in its entiretyby reference.

1. Field of the Invention

The present invention relates to a method and apparatus for encoding anddecoding motion vectors. More specifically, the present inventionrelates to a method and apparatus for encoding and decoding motionvectors calculated with reference to a plurality of pictures.

2. Description of the Related Art

According to MPEG-1 or MPEG-2 coding standards, P-picture coding thatrefers to a previous picture or B-picture coding that refers to bothprevious and following pictures is adapted to encode a present picture,and motion compensation is carried out on the basis of the coding type.Further, in order to improve coding efficiency, prediction coding iscarried out using motion vectors of neighbor blocks so that therelationship between the motion vectors of the neighbor blocks can bereflected, rather than directly coding the motion vector of the presentblock itself.

Occasionally, the motion vectors of the neighbor blocks used in theprediction coding may not refer to the same reference picture as thatwhich refers to the motion vector of the present block. If such anoccasion arises, it is conventional to exclude the motion vectors of theneighbor blocks referring to a different reference picture from theprediction coding process, because the coding efficiency can be loweredin the event that the motion vectors obtained on the basis of thedifferent reference picture are use in the prediction coding. However,in the case of excluding the motion vectors of the neighbor blocksreferring to the different reference picture from the prediction codingprocess, the relationship between the motion vectors of the neighborblocks is not sufficiently reflected and, therefore, the codingefficiency of the motion vectors can be correspondingly lowered. Theproblem is much more serious in the case of pictures including more suchblocks that refer to different reference pictures.

SUMMARY OF THE INVENTION

The present invention provides a method and apparatus for encoding anddecoding motion vectors, in which prediction coding can be much moreefficiently carried out even when the motion vectors refer to differentreference pictures.

Another object of the present invention is to provide a method andapparatus for encoding and decoding motion vectors, in which codingefficiency can be improved by adjusting at least some motion vectorsreferring to different reference pictures.

A method for encoding motion vectors according to the present inventioncomprises: (a) predicting a motion vector of a type identical to that ofa present block and obtaining a predictive motion vector with respect toneighbor blocks having motion vectors of a type different from that ofthe present block among a plurality of neighbor blocks adjacent to thepresent block; (b) calculating a representative value of the motionvectors of the type identical to that of the present block from themotion vectors of the neighbor blocks and the predictive motion vector;(c) calculating a difference value between the calculated representativevalue and the motion vector of the present block; and (d) encoding thecalculated difference value.

An apparatus for encoding motion vectors according to the presentinvention comprises a motion vector predictor for predicting a motionvector of a type identical to that of a present block and producing apredictive motion vector with respect to neighbor blocks having motionvectors of a type different from that of the present block among aplurality of neighbor blocks adjacent to the present block, and forcalculating a representative value of the motion vectors of the typeidentical to that of the present block from the motion vectors of theneighbor blocks and the predictive motion vector and calculating adifference value between the calculated representative value and themotion vector of the present block; and a motion vector encoder forencoding the calculated difference value.

According to the present invention, it is preferable that the motionvector predictor calculates a predictive forward motion vector MVf(predictive) as the predictive motion vector, when the motion vector ofthe present block is a forward motion vector MVf and the motion vectorof the neighbor block is a backward motion vector MVb, according to thefollowing equation:${{MVf}({predictive})} = {\frac{d\quad 1}{{d\quad 2} - {d\quad 1}} \times {MVb}}$where d1 is a distance between a present picture to which the neighborblock belongs and a previous picture to which the neighbor block refers,and d2 is a distance between a following picture to which the neighborblock refers and the previous picture to which the neighbor blockrefers.

According to the present invention, it is preferable that the motionvector predictor calculates a predictive backward motion vectorMVb(predictive) as the predictive motion vector, when the motion vectorof the present block is a backward motion vector MVb and the motionvector of a neighbor block is a forward motion vector MVf, according tothe following equation:${{MVb}({predictive})} = {\frac{{d\quad 2} - {d\quad 1}}{d\quad 1} \times {MVf}}$where d1 is a distance between a present picture to which the neighborblock belongs and a previous picture to which the neighbor block refers,and d2 is a distance between a following picture to which the neighborblock refers and the previous picture to which the neighbor blockrefers.

Further, according to the present invention, it is preferable that themotion vector predictor calculates a predictive value PMV_X as therepresentative value according to the following equation:PMV _(—) X=median(MVf _(—) A, MVf _(—) B, MVf _(—) C) or median(MVb _(—)A, MVb _(—) B, MVb _(—) C)where MVf_A,MVf_B,MVf_C,MVb_A, MVb_B, and MVb_C are components of motionvectors of neighbor blocks in which MVf_A is a forward motion vector ofa left block, MVf_B is a forward motion vector of an upper block, MVf_Cis a forward motion vector of an upper-right block, MVb_A is a backwardmotion vector of a left block, MVb_B is a backward motion vector of anupper block, and MVb _C is a backward motion vector of an upper-rightblock, one of which can be the predictive motion vector.

Meanwhile, a method for decoding motion vectors according to the presentinvention comprises: (a) predicting a motion vector of a type identicalto that of a present block and obtaining a predictive motion vector withrespect to neighbor blocks having motion vectors of a type differentfrom that of the present block among a plurality of neighbor blocksadjacent to the present block; (b) calculating a representative value ofthe motion vectors of the type identical to that of the present blockfrom the motion vectors of the neighbor blocks and the predictive motionvector; and (c) calculating the motion vector of the present block byadding the calculated representative value and a decoded differencevalue.

According to the present invention, it is preferable that a predictiveforward motion vector MVf( predictive) is calculated as the predictivemotion vector, when the motion vector of the present block is a forwardmotion vector MVf and the motion vector of the neighbor block is abackward motion vector MVb, according to the following equation:${{MVf}({predictive})} = {\frac{t\quad 1}{{t\quad 2} - {t\quad 1}} \times {MVb}}$where t1 is a time difference between a present picture to which theneighbor block belongs and a previous picture to which the neighborblock refers, and t2 is a time difference between a following picture towhich the neighbor block refers and the previous picture to which theneighbor block refers.

According to the present invention, it is preferable that a predictivebackward motion vector MVb(predictive) is calculated as the predictivemotion vector, when the motion vector of the present block is a backwardmotion vector MVb and the motion vector of a neighbor block is a forwardmotion vector MVf, according to the following equation:${{MVb}({predictive})} = {\frac{{t\quad 2} - {t\quad 1}}{t\quad 1} \times {MVf}}$where t1 is a time difference between a present picture to which theneighbor block belongs and a previous picture to which the neighborblock refers, and t2 is a time difference between a following picture towhich the neighbor block refers and the previous picture to which theneighbor block refers.

According to the present invention, it is preferable that a predictiveforward motion vector MVf (predictive) is calculated as the predictivemotion vector, when the motion vector of the present block is a forwardmotion vector MVf and the motion vector of the neighbor block is abackward motion vector MVb, according to the following equation:${{MVf}({predictive})} = {\frac{d\quad 1}{{d\quad 2} - {d\quad 1}} \times {MVb}}$where d1 is a distance between a present picture to which the neighborblock belongs and a previous picture to which the neighbor block refers,and d2 is a distance between a following picture to which the neighborblock refers and the previous picture to which the neighbor blockrefers.

According to the present invention, it is preferable that a predictivebackward motion vector MVb(predictive) is calculated as the predictivemotion vector, when the motion vector of the present block is a backwardmotion vector MVb and the motion vector of a neighbor block is a forwardmotion vector MVf, according to the following equation:${{MVb}({predictive})} = {\frac{{d\quad 2} - {d\quad 1}}{d\quad 1} \times {MVf}}$where d1 is a distance between a present picture to which the neighborblock belongs and a previous picture to which the neighbor block refers,and d2 is a distance between a following picture to which the neighborblock refers and the previous picture to which the neighbor blockrefers.

Further, according to the present invention, it is preferable that thestep (b) of the decoding method includes the step of calculating apredictive value PMV_X for decoding as the representative valueaccording to the following equation:PMV _(—) X=median(MVf _(—) A,MVf _(—) B,MVf _(—) C) or median(MVb _(—)A,MVb _(—) B, MVb _(—) C)where MVf_A, MVf_B, MVf_C, MVb_A, MVb_B, and MVb_C are components ofmotion vectors of neighbor blocks in which MVf_A is a forward motionvector of a left block, MVf_B is a forward motion vector of an upperblock, MVf_C is a forward motion vector of an upper-right block, MVb_Ais a backward motion vector of a left block, MVb_B is a backward motionvector of an upper block, and MVb_C is a backward motion vector of anupper-right block, and one of these vectors can be the predictive motionvector.

Meanwhile, an apparatus for decoding motion vectors according to thepresent invention comprises a motion vector decoder for decoding adifference value; and a motion vector prediction compensator whichpredicts a motion vector of a type identical to that of a present blockand obtaining a predictive motion vector with respect to neighbor blockshaving motion vectors of a type different from that of the present blockamong a plurality of neighbor blocks adjacent to the present block,calculates a representative value of the motion vectors of the typeidentical to that of the present block from the motion vectors of theneighbor blocks and the predictive motion vector and calculates themotion vector of the present block by adding the calculatedrepresentative value and a decoded difference value.

According to the present invention, it is preferable that the motionvector prediction compensator calculates a predictive forward motionvector MVf (predictive) as the predictive motion vector, when the motionvector of the present block is a forward motion vector MVf and themotion vector of the neighbor block is a backward motion vector MVb,according to the following equation:${{MVf}({predictive})} = {\frac{t\quad 1}{{t\quad 2} - {t\quad 1}} \times {MVb}}$where t1 is a time difference between a present picture to which theneighbor block belongs and a previous picture to which the neighborblock refers, and t2 is a time difference between a following picture towhich the neighbor block refers and the previous picture to which theneighbor block refers.

According to the present invention, it is preferable that the motionvector prediction compensator calculates a predictive backward motionvector MVb(predictive) as the predictive motion vector, when the motionvector of the present block is a backward motion vector MVb and themotion vector of a neighbor block is a forward motion vector MVf,according to the following equation:${{MVb}({predictive})} = {\frac{{t\quad 2} - {t\quad 1}}{t\quad 1} \times {MVf}}$where t1 is a time difference between a present picture to which theneighbor block belongs and a previous picture to which the neighborblock refers, and t2 is a time difference between a following picture towhich the neighbor block refers and the previous picture to which theneighbor block refers.

According to the present invention, it is preferable that the motionvector prediction compensator calculates a predictive forward motionvector MVf (predictive) as the predictive motion vector, when the motionvector of the present block is a forward motion vector MVf and themotion vector of the neighbor block is a backward motion vector MVb,according to the following equation:${{MVf}({predictive})} = {\frac{d\quad 1}{{d\quad 2} - {d\quad 1}} \times {MVb}}$where d1 is a distance between a present picture to which the neighborblock belongs and a previous picture to which the neighbor block refers,and d2 is a distance between a following picture to which the neighborblock refers and the previous picture to which the neighbor blockrefers.

According to the present invention, it is preferable that the motionvector prediction compensator calculates a predictive backward motionvector MVb(predictive) as the predictive motion vector, when the motionvector of the present block is a backward motion vector MVb and themotion vector of a neighbor block is a forward motion vector MVf,according to the following equation:${{MVb}({predictive})} = {\frac{{d\quad 2} - {d\quad 1}}{d\quad 1} \times {MVf}}$where d1 is a distance between a present picture to which the neighborblock belongs and a previous picture to which the neighbor block refers,and d2 is a distance between a following picture to which the neighborblock refers and the previous picture to which the neighbor blockrefers.

Moreover, the objects of the present invention can be achieved by acomputer readable information recording medium on which program codesfor implementing the above described encoding or decoding method arerecorded.

BRIEF DESCRIPTION OF THE DRAWINGS

The above and other aspects and advantages of the present invention willbecome more apparent by describing, in detail, preferred embodimentsthereof with reference to the attached drawings in which:

FIG. 1 is a block diagram of a motion vector encoding apparatusaccording to a preferred embodiment of the present invention;

FIG. 2 is a block diagram of an image data coding apparatus includingthe motion vector encoding apparatus shown in FIG. 1 according to apreferred embodiment of the present invention;

FIG. 3 illustrates an example of input image data;

FIG. 4 is a block diagram of a motion vector decoding apparatusaccording to a preferred embodiment of the present invention;

FIG. 5 is a block diagram of an image data decoding apparatus includingthe motion vector decoding apparatus shown in FIG. 4 according to apreferred embodiment of the present invention;

FIG. 6 illustrates a multiple-reference method according to a preferredembodiment of the present invention;

FIG. 7 illustrates motion compensation blocks that constitute units ofmotion compensation according to a preferred embodiment of the presentinvention;

FIG. 8 illustrates a method for obtaining a predictive motion vectoraccording to a preferred embodiment of the present invention;

FIG. 9 illustrates a method for obtaining a predictive motion vector;

FIG. 10 illustrates another method for obtaining a predictive motionvector; and

FIG. 11 illustrates a method for obtaining a predictive motion vectorwith respect to a rectangular motion compensation block.

DETAILED DESCRIPTION OF THE INVENTION

An apparatus for encoding motion vectors according to a preferredembodiment of the present invention is shown in FIG. 1 as a blockdiagram. Referring to FIG. 1, an encoding apparatus 70 for encodingmotion vectors comprises a motion vector predictor 701 and a motionvector encoder 702. When motion vectors of a plurality of blocks arereceived, the motion vector predictor 701 estimates motion vectors of atype identical to that of a present block and produces predictive motionvectors with respect to neighbor blocks having motion vectors of a typedifferent from that of the present block among a plurality of neighborblocks adjacent to the present block, and calculates a representativevalue of the motion vectors of the type identical to that of the presentblock from the motion vectors of the neighbor blocks and the predictivemotion vectors and, then, calculates a difference value between thecalculated representative value and the motion vector of the presentblock. The motion vector encoder 702 encodes the difference valueprovided from the motion vector predictor 701. In a preferred embodimentof the present invention, the motion vector encoder 702 encodes adifferential value as the difference value.

FIG. 2 is a block diagram of an image data coding apparatus includingthe motion vector encoding apparatus shown in FIG. 1 according to apreferred embodiment of the present invention. Referring to FIG. 2, theimage data coding apparatus of the type incorporating amultiple-reference method comprises a coding controller 100, a firstsource encoder 200, and a second source encoder 700. Further, the imagedata coding apparatus comprises a source decoder 300, a memory 400, amotion compensator 500, and a motion predictor 600.

Input image data is comprised of frames provided from a camera along atime axis as shown in FIG. 3, or blocks obtained by dividing the framesto have predetermined sizes. Each frame may be a progressive scannedframe obtained through progressive scanning, or an interlaced scannedfield or frame obtained through interlaced scanning. Therefore, theimage data described below represents a picture having a format of aprogressive scanned frame, an interlaced scanned frame, a field, or ablock.

When an image is input, the coding controller 100 determines a codingtype, i.e., an intra-coding type or an inter-coding type, based onwhether to carry out motion compensation for the input image accordingto the characteristic of the input image or an operation desired by auser, and outputs a corresponding control signal to a first switch S1.For the motion compensation, the first switch SI is turned on because aprevious or a following input image is needed. If motion compensation isnot required, the first switch S1 is turned off because the previous orthe following input image is not needed. If the first switch S1 isturned on, differential image data between the input image and theprevious image is provided to the first source encoder 200. If the firstswitch S1 is turned off, the input image data is provided to the firstsource encoder 200.

The first source encoder 200 quantizes transformation coefficientsobtained by transforming the input image data according to apredetermined quantization process, and produces N×M data, which istwo-dimensional data comprised of the quantized transformationcoefficients. An example of transformation used is discrete cosinetransformation (DCT). The quantization is performed according topredetermined quantization steps or wavelet transformation.

The input image data received by and coded through the first sourceencoder 200 can be used as reference data for motion compensation of afollowing or a previous input image data. Therefore, such coded inputimage data is inverse-quantized and inverse-transformed through thefirst source decoder 300 which processes data inversely to the firstsource encoder 200 and, then, stored in the memory 400. If the dataoutput from the first source decoder 300 is differential image data, thecoding controller 100 turns on a second switch S2 so that thedifferential image data is added to an output of the motion compensator500 and, then, stored in the memory 400.

The motion predictor 600 compares the input image data with the datastored in the memory 400, and searches data mostly approximate to theinput image data provided at present. After comparing the searched datawith the input image data provided at present, the motion predictor 600outputs a motion vector (MV). The motion vector is obtained withreference to at least one picture. In other words, the motion vector canbe produced with reference to a plurality of previous and/or followingpictures. When the motion vector is provided to the memory 400, thememory 400 outputs corresponding data to the motion compensator 500.Based on the data provided from the memory 400, the motion compensator500 produces a compensation value corresponding to the presently codedimage data.

The second source encoder 700 receives the quantized transformationcoefficients from the first source encoder 200 and information on themotion vector from the motion predictor 600, and encodes and outputscoding type information, quantization information, and other informationrequired for decoding, which is received from the coding controller 100,and ultimately outputs a bit stream.

The motion vector encoding apparatus 70 according to the presentinvention is included in the second source encoder 700. Therefore, amethod for encoding motion vectors according to the present invention isimplemented by the second source encoder 700. As in the MPEG-4 codingstandard or the H.263 coding standard, the source encoder 700 implementsprediction coding using motion vectors of neighbor blocks so that therelationship between the motion vectors of the neighbor blocks can bereflected and coding efficiency can be improved, rather than directlycoding the motion vector of the present block itself.

FIG. 4 is a block diagram of a motion vector decoding apparatusaccording to a preferred embodiment of the present invention. Referringto FIG. 4, the motion vector decoding apparatus 130 comprises a motionvector decoder 131 and a motion vector prediction compensator 132. Themotion vector decoder 131 receives and decodes an encoded motion vectordifference value to reconstruct the difference value. In order to obtainan original motion vector from the reconstructed difference value, apredictive value that has been used in calculation of the differencevalue should be obtained and, then, added to the difference value. Forthis purpose, the motion vector prediction compensator 132 estimatesmotion vectors of a type identical to that of a present block andproduces predictive motion vectors with respect to neighbor blockshaving motion vectors of a type different from that of the present blockamong a plurality of neighbor blocks adjacent to the present block, andcalculates a representative value of the motion vectors of the typeidentical to that of the present block from the motion vectors of theneighbor blocks and the predictive motion vectors and, then, calculatesthe motion vector of the present block by adding the calculatedrepresentative value of the difference value reconstructed by the motionvector decoder 131.

A method for decoding motion vectors according to the present inventionis implemented by the motion vector decoding apparatus 130. As in theMPEG-4 coding standard or the H.263 coding standard, the motion vectordecoding apparatus 130 implements prediction decoding using motionvectors of neighbor blocks so that the relationship between the motionvectors of the neighbor blocks can be reflected and coding efficiencycan be improved, rather than directly decoding the motion vector of thepresent block itself.

FIG. 5 is a block diagram of an image data decoding apparatus includingthe motion vector decoding apparatus shown in FIG. 4 according to apreferred embodiment of the present invention. Referring to FIG. 5, theimage data decoding apparatus comprises a demultiplexer 110 fordemultiplexing a bit stream, a second source decoder 710, and a firstsource decoder 210. Further, the image data decoding apparatus comprisesa coding type information decoder 120 for decoding coding-typeinformation, and a motion vector decoder 130 for decoding motion vectorsaccording to the present invention.

The demultiplexer 110 demultiplexes the bit stream into entropy-codedand quantized transformation coefficients, motion vector information,coding type information, etc. The second source decoder 710entropy-decodes the coded transformation coefficients and outputsquantized transformation coefficients. The first source decoder 210source-decodes the quantized transformation coefficients. That is, thefirst source decoder 210 processes data inversely to the first sourceencoder 200. For example, if the first source encoder 200 performsdiscrete cosine transformation (DCT), the first source decoder 210performs inverse discrete cosine transformation (IDCT). Consequently,the image data is reconstructed. The reconstructed image data is storedin a memory 410 for motion compensation.

The coding type information decoder 120 discriminates the coding type.If the coding type is an inter type that requires motion compensation,the coding type information decoder 120 turns on a third switch S30 sothat a motion compensation value provided from a motion compensator 510is added to the data provided from the first source decoder 210 toproduce the recovered image data. The motion vector decoder 130indicates a location directed by the motion vector obtained from themotion vector information, and the motion compensator 510 produces amotion compensation value from the reference image data directed by themotion vector. The motion vector encoder 130 is identical, in itsoperation and structure, to the motion vector decoding apparatus 130shown in FIG. 4 and, therefore, a detailed description thereof isomitted.

FIG. 6 illustrates a multiple-reference method according to a preferredembodiment of the present invention. Referring to FIG. 6, a pictureI_(o) is an intra picture that is obtained without reference to otherpictures, pictures B₁, B₂, et al. are bi-predictive pictures that areobtained with reference to two different pictures, and pictures P₄, P₈,et al. are predictive pictures that are obtained with reference to theintra picture only. Arrows indicate dependency of the pictures requiredfor decoding. Specifically, picture B₂ is dependent on pictures I₀ andP_(4,) picture B₁ is dependent on pictures I₀, P₄ and B₂, and picture B₃is dependent on pictures I₀, P₄, B₁, and B₂. Therefore, while the orderof display is I₀, B₁, B₂, B₃, P₄, and so on, the order of transmissionbecomes I₀, P₄, B₂, B₁, B₃, et al. As described above, the motion vectorencoding apparatus shown in FIG. 1 produces bi-predictive pictures thatare obtained with reference to a plurality of pictures. In other words,motion vectors in the encoding and decoding method according to thepresent invention are produced in at least one mode including abi-predictive mode among forward predictive, backward predictive,bidirectional predictive, and direct predictive modes. In thebi-predictive mode, the two different reference pictures are bothprevious pictures or both following pictures.

FIG. 7 illustrates motion compensation blocks that constitute units ofmotion compensation according to a preferred embodiment of the presentinvention. Referring to FIG. 7, a picture is comprised of a plurality ofmotion compensation blocks. The motion compensation blocks include a16×16 macro block (MB) according to an embodiment of the presentinvention as well as a 16×8 block to be obtained by horizontallydividing the 16×16 macro block, an 8×16 block to be obtained byvertically dividing the 16×16 macro block, an 8×8 block to be obtainedby horizontally and vertically dividing the 16×16 macro block, an 8×4 or4×8 block to be obtained by horizontally or vertically dividing againthe 8×8 block, and a 4×4 block to be obtained by horizontally andvertically dividing again the 8×8 block.

The motion vector encoding method according to the present inventionuses differential pulse code modulation, which encodes a differencevalue between a representative value of neighbor blocks adjacent to thepresent block, e.g., a median value in a preferred embodiment of thepresent invention, and a motion vector MV_X of the present block.Specifically, if the motion vectors of a left block A, an upper block B,and an upper-right block C, which are neighbor blocks adjacent to thepresent block X, are defined as MV_A, MV_B, and MV_C, respectively, apredictive motion vector PMV_X, which is a predictive value for encodinga differential vector and the differential vector DMV_X , which is adifferential value using the predictive value, are calculated accordingto the following equation:PMV _(—) X=median(MV _(—) A, MV _(—) B, MV _(—) C)DMV _(—) X=MV _(—) X−PMV _(—) X   (1)

The calculation is made on each of the component values, i.e. the xcomponent and the y component values, independently. Meanwhile, the leftblock A is a block including a pixel which is adjacent to and to theleft of the left-most pixel in a first row of the present block X, theupper block B is a block including a pixel which is adjacent to andabove the left-most pixel in the first row of the present block X, andthe upper-right block C is a block including a pixel which is adjacentto and to the upper right of the right-most pixel in the first row ofthe present block X.

The motion vector decoding method according to the present inventionfollows a decoding method that obtains a motion vector MV_X of thepresent block by adding a representative value of neighbor blocks to thepresent block, e.g. a median value in a preferred embodiment of thepresent invention, and a decoded difference value MVD_X. Specifically,if the motion vectors of a left block A, an upper block B, and anupper-right block C, which are neighbor blocks to the present block X,are defined as MV_A, MV_B, and MV_C, respectively, a predictive motionvector PMV_X, which is a predictive value for decoding, and the motionvector MV_X, which is obtained by adding a decoded difference valueMVD_X to the predictive motion vector PMV_X, are calculated according tothe following equation:PMV _(—) X=median(MV _(—) A, MV _(—) B, MV _(—) C)MV _(—) X=DMV _(—) X+PMV _(—) X   (2)

The calculation is made on each of the component values, i.e. the xcomponent and the y component values, independently.

While there may be exceptional cases in obtaining motion vectorsaccording to the encoding and decoding method as described above, thefollowing logic can be applied to such exceptional cases.

Firstly, in a case where any of neighbor blocks A, B, C, and D islocated outside of a picture or slice, the following logic is applied.It is noted that the slice is a minimal unit of a series of data rowshaving a starting code. The slice has a predetermined length, and iscomprised of a macro block. Further, the slice does not exist overseveral pictures, but in only one picture.

If both of the blocks A and D are located outside of the picture orslice, it is regarded that MV_A=MV_D=0 and that the blocks A and D havea different reference picture from that of the present block X.

2) If all of the blocks B, C and D are located outside of the picture orslice, it is regarded that MV_B=MV_C=MV_A and that, in the case oftaking a median value, MV_A should be the predictive motion vector PMV_Xof the present block X.

3) If the block C is located outside of the picture or slice, the blockC is replaced with the block D. The block D is above and to the left ofthe present block X, which includes a pixel that is adjacent to andabove the left-most pixel of the first row of the present block X.

Secondly, in a case where the neighbor blocks are intra-coded, i.e. ifthere is an intra-coded block among the neighbor blocks A, B, C, and D,it is regarded that the motion vector of the intra-coded block is zeroand has a different reference picture.

Thirdly, in a case where the neighbor blocks have a different referencepicture from that of the present block, a predictive motion vector isobtained according to the method of the present invention and, then, thepredictive motion vector is used in obtaining a median value. In otherwords, if the present block and the neighbor blocks participating in theprediction coding have different types of motion vectors, a predictivemotion vector of an identical type to that of the present block isobtained according to the method of the present invention and, then, amedian value is obtained by substituting the predictive motion vector inthe equations (1) and (2) described above.

FIG. 8 illustrates a method for obtaining a predictive motion vectoraccording to a preferred embodiment of the present invention. Referringto FIG. 8, the present block X has a forward motion vector MVf_X, andthe neighbor blocks A and D have forward motion vectors MVf_A and MVf_D,respectively, of a type identical to that of the present block X.However, the neighbor block B has a backward motion vector MVb_B of atype different from that of the present block X, and the block Cincludes both a forward motion vector MVf_C and a backward motion vectorMVb_C.

A median value according to the equations (1) and (2) should be obtainedwith respect to motion vectors having an identical type to that of thepresent block X, because the motion vectors having a different type fromthat of the present block may cause degradation of encoding and decodingefficiencies, if such different types of motion vectors are involved inthe encoding and decoding. In this regard, since the neighbor block Bdoes not have an identical type motion vector to the present block, apredictive motion vector for the neighbor block B should be obtainedfirst. In other words, a forward motion vector of a type identical tothe present block X should be predicted first.

FIG. 9 illustrates a method for obtaining a predictive motion vector.Referring to FIG. 9, a predictive forward motion vector MVf( predictive)or a predictive backward motion vector MVb(predictive) as a predictivemotion vector of a neighbor block can be obtained from the followingequation: $\begin{matrix}{{{{MVb}\quad({predictive})} = {\frac{\left( {{DISTANCE\_ B} - {DISTANCE\_ A}} \right)}{DISTANCE\_ B} \times {MVf}}}{{{MVf}\quad({predictive})} = {\frac{DISTANCE\_ B}{\left( {{DISTANCE\_ B} - {DISTANCE\_ A}} \right)} \times {MVb}}}} & (3)\end{matrix}$where DISTANCE_A is a distance between reference pictures 1 and 2referred to by the present picture including a corresponding neighborblock, and DISTANCE_B is a distance between the present pictureincluding a corresponding neighbor block and reference picture 1. In theembodiment of the present invention, reference picture 1 is a previouspicture to the present picture, and reference picture 2 is a followingpicture.

FIG. 10 illustrates another method for obtaining a predictive motionvector. Referring to FIG. 10, a predictive forward motion vector MVf(predictive) or a predictive backward motion vector MVb(predictive) as apredictive motion vector of a neighbor block can be obtained from thefollowing equation: $\begin{matrix}{{{{MVb}\quad({predictive})} = {\frac{\left( {{TR\_ B} - {TR\_ A}} \right)}{TR\_ B} \times {MVf}}}{{{MVf}\quad({predictive})} = {\frac{TR\_ B}{\left( {{TR\_ B} - {TR\_ A}} \right)} \times {MVb}}}} & (4)\end{matrix}$where TR_A is a time difference between reference pictures 1 and 2referred to by the present picture including a corresponding neighborblock, and TR_B is a time difference between the present pictureincluding a corresponding neighbor block and the reference picture 1.The time difference can be obtained from counter values TR, i.e.temporal references for indicating the order in which the pictures aredisplayed.

Meanwhile, the motion vector encoding method according to the presentinvention is particularly efficient for bi-predictive pictures. Furtherdescriptions regarding the bi-predictive pictures are provided below.

The bi-predictive picture does not have a limitation where motioncompensation must be carried out using previous and following picturesin terms of time. Therefore, a motion vector of a present block includedin the bi-predictive picture is independent in terms of time ordirection. In other words, since the bi-predictive picture is obtainedwith reference to a plurality of pictures, it is most likely that thepresent block and the neighbor blocks have different types of motionvectors. Nevertheless, the motion vector of the present block includedin the bi-predictive picture can be encoded and decoded according to theencoding and decoding method of the present invention regardless of thetype of motion vectors of the neighbor blocks.

Since the bi-predictive picture has four motion compensation modes,there are four motion vectors including a forward motion vector MVf, abackward motion vector MVb, a bi-predictive motion vector MVf and MVb,and a direct motion vector. While there is no need to encode or decodethe direct motion vector since there is no need to transmit motionvector information to a transmitter stage, the remaining motion vectorsmust be encoded and decoded using a predictive motion vector PMVobtained from the motion vectors of the neighbor blocks as for apredictive picture.

Since the motion vector of the present block included in thebi-predictive picture is independent in terms of time or direction asdescribed above, whether the motion vector of the present block isforward or backward is not necessarily classified in a certain time ordirection. Further, it is not necessary for the bi-predictive motionvector to be classified in a certain time or direction and to includeprevious and following components based upon a certain time or a certainlocation.

In order to obtain a predictive motion vector PMV, MVf and MVb utilize amotion vector of an identical type to those of neighbor blocks. In otherwords, MVf utilizes neighbor MVf's only in obtaining a predictive motionvector, and MVb utilizes peripheral MVf's only. However, since abi-predictive motion vector includes both MVf and MVb, MVf and MVb ofthe bi-predictive motion vector utilize corresponding types of motionvectors. Accordingly, when a predictive motion vector PMV must beobtained for encoding or decoding motion vectors of a bi-predictivepicture, the motion vectors having the identical type can be predictedaccording to the method as described with reference to FIGS. 9 and 10 ina case where the type of the motion vectors of neighbor blocks aredifferent.

Referring again to FIG. 7, when MVf_X=(1, 2), MVf_A=(4, 2), MVb_B=(−1,−1), MVf_C=(0, 3), and MVb_C=(−1, −2), MVb_B=(−1, −1) must be excludedand (0, 0) is substituted therewith to obtain a median value accordingto a conventional method, since MVb_B is a different type of motionvector from the present block. Therefore, the median value becomes (0,3), and a differential value DMV_X becomes (1, −1). However, accordingto the present invention, a predictive value (1,1) is used instead ofMVb_B=(−1, −1). Therefore, the median value becomes (1, 1), and thedifferential value DMV_X becomes (0, 1).

Meanwhile, a motion compensation block may have a rectangular shape.Since a direction of a motion vector can be predicted in a case of sucha rectangular type motion compensation block, the predictive motionvector must be obtained in a method different from that of using amedian value of the motion vectors of three neighbor blocks as apredictive motion vector.

FIG. 11 illustrates a method for obtaining a predictive motion vectorwith respect to a rectangular motion compensation block. Referring toFIG. 11, in a case where a motion compensation block is an 8×16 block, amotion vector of a left neighbor block is used as a predictive motionvector of block {circle around (1)}, and a motion vector of anupper-right neighbor block is used as a predictive motion vector ofblock {circle around (2)}.

In a case where the motion compensation block is a 16×8 block, a motionvector of an upper neighbor block is used as a predictive motion vectorof block {circle around (3)}, and a motion vector of a left neighborblock is used as a predictive motion vector of block {circle around(4)}.

In a case where the motion compensation block is an 8×4 block, apredictive motion vector of block {circle around (5)} is obtained usinga median value of previous blocks, and a motion vector of a leftneighbor block is used as a predictive motion vector of block {circlearound (6)}.

In a case where the motion compensation block is a 4×8 block, apredictive motion vector of block {circle around (7)} is obtained usinga median value of previous blocks, and a motion vector of an upperneighbor block is used as a predictive motion vector of block {circlearound (8)}.

However, if a reference picture of the motion vector determined as apredictive motion vector is different from that of the present block,the existing median value is used. In other exceptional cases,prediction of a median value as described above is applied.

The above described encoding method and decoding method can beincorporated into a computer program. A computer programmer in the fieldof the present invention may easily deduce codes or code segments toconstitute the computer program. Further, the program can be stored in acomputer readable information-recording medium, and can be read andimplemented to realize the coding method and decoding method. Thecomputer readable information-recording medium includes magneticrecording media, optical recording media, and carrier wave media.

As described above, according to the present invention, the motionvectors are encoded and decoded by predicting motion vectors of a typeidentical to that of a present block with respect to neighbor blockshaving motion vectors of a type different from that of the presentblock; obtaining a median value based upon the prediction; encoding adifferential value obtained on the basis of the median value; andobtaining a motion vector of the present block by adding the decodeddifferential value and the median value that is obtained on the basis ofprediction of motion vectors of a type identical to that of a presentblock with respect to neighbor blocks having motion vectors of a typedifferent from that of the present block. Consequently, encoding anddecoding efficiencies can be improved.

In other words, using a representative value, i.e. a median value in apreferred embodiment of the present invention, of the motion vectors ofneighbor blocks in encoding and decoding a motion vector of the presentblock is based upon a presumption that the motions of the neighborblocks are similar. Therefore, according to the encoding and decodingmethod of the present invention, a conventional problem of excluding themotion vectors of the neighbor blocks referring to the differentreference picture from the prediction coding process and insufficientlyreflecting the relationship between the motion vectors of the neighborblocks can be solved. Further, encoding and decoding efficiencies can beimproved even when the motion vectors refer to different referencepictures by obtaining a predictive motion vector of an identical typeand reflecting the predictive motion vector for obtaining arepresentative value, e.g. a median value.

While the present invention has been particularly shown and describedwith reference to preferred embodiments thereof, it will be understoodby those of ordinary skill in the art that various changes in form anddetails may be made therein without departing from the spirit and scopeof the present invention as defined by the appended claims.

1-28. (canceled)
 29. A method for decoding motion vectors comprising: selecting a neighbor block having a motion vector used to obtain a predictive motion vector of a present block included in a macroblock according to a size and a location of the present block; and determining the motion vector of the neighbor block as a predictive motion vector of present block, wherein, if the present block is 16×8 and located in an upper side of the macroblock, the motion vector of the neighbor block located in an upper side of the present block is selected as the predictive motion vector of present block.
 30. The decoding method according to claim 29, further comprising: reconstructing a difference value between an original motion vector and the predictive motion vector of the present block; and adding the difference value to the predictive motion vector of the present block.
 31. An apparatus for decoding motion vectors comprising: a motion vector decoder for decoding a difference value; and a motion vector prediction compensator which selects a neighbor block having a motion vector used to obtain a predictive motion vector of a present block included in a macroblock according to a size and a location of the present block, determines the motion vector of the neighbor block as a predictive motion vector of present block and calculates the motion vector of the present block by adding the determined predictive motion vector and the decoded difference value, wherein, if the present block is 16×8 and located in an upper side of the macroblock, the motion vector of the neighbor block located in an upper side of the present block is selected as the predictive motion vector of present block. 